GtkLabelPrivate *priv = label->priv;
PangoLayout *layout;
PangoRectangle rect;
- gint text_width, ellipsize_chars, guess_width;
+ gint text_width, guess_width;
/* "width-chars" Hard-coded minimum width:
* - minimum size should be MAX (width-chars, strlen ("..."));
pango_layout_get_extents (layout, NULL, &rect);
text_width = rect.width;
- /* enforce minimum width for ellipsized labels at ~3 chars */
- if (priv->ellipsize)
- ellipsize_chars = 3;
- else
- ellipsize_chars = 0;
-
/* "width-chars" Hard-coded minimum width:
* - minimum size should be MAX (width-chars, strlen ("..."));
* - natural size should be MAX (width-chars, strlen (priv->text));
if (priv->ellipsize || priv->wrap)
{
- gint char_pixels;
+ gint char_pixels, ellipsize_chars;
char_pixels = get_char_pixels (GTK_WIDGET (label), layout);
+ /* enforce minimum width for ellipsized labels at ~3 chars */
+ ellipsize_chars = priv->ellipsize ? 3 : 0;
+
required->width = char_pixels * MAX (priv->width_chars, ellipsize_chars);
/* Default to the minimum width regularly guessed by GTK+ if no minimum